﻿using DreamWork.Model.ViewModel;

namespace DreamWork.Services
{
    public abstract class ServiceBase
    {
        public ServiceResult Success()
        {
            return new ServiceResult()
            {
                IsSuccess = true
            };
        }
        public ServiceResult<T> Success<T>(T Data)
        {
            return Success(Data, string.Empty);
        }
        public ServiceResult<T> Success<T>(T data, string message)
        {
            return new ServiceResult<T>()
            {
                IsSuccess = true,
                Data = data,
                Message = message
            };
        }
        public ServiceResult Error(string message)
        {
            return new ServiceResult()
            {
                IsSuccess = false,
                Message = message
            };
        }
        public ServiceResult<T> Error<T>(string message)
        {
            return new ServiceResult<T>()
            {
                IsSuccess = false,
                Message = message
            };
        }
        public ServiceResult<T> Error<T>(T data, string message)
        {
            return new ServiceResult<T>()
            {
                IsSuccess = false,
                Message = message,
                Data = data,
            };
        }
    }
}
